<!DOCTYPE html>
<meta charset="utf-8">
<title>Worklet: addModule() for a filesystem URL</title>
<body>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
<script>

// This test should not be upstreamed to WPT because Filesystem API is
// implemented only by Chrome.
promise_test(() => {
  return new Promise(resolve => {
      const kSize = 100;
      webkitRequestFileSystem(TEMPORARY, kSize, resolve, assert_unreached);
    }).then(fs => {
      return new Promise(resolve => {
          fs.root.getFile('test.js', {create: true}, resolve, assert_unreached);
        });
    }).then(entry => {
      return CSS.paintWorklet.addModule(entry.toURL());
    }).then(() => {
      assert_unreached('addModule should fail.');
    }).catch(error => {
      assert_equals(error.name, 'AbortError');
    });
}, 'Importing a filesystem URL should reject the given promise');

</script>
</body>
